Skip to content

ADFA-2602: Move the on-device toolchain to Gradle 9.6.1, AGP 9.3.1, Kotlin 2.3.21 - #1647

Open
Daniel-ADFA wants to merge 2 commits into
task/ADFA-2602-offline-buildscript-reposfrom
task/ADFA-2602-toolchain-agp9
Open

ADFA-2602: Move the on-device toolchain to Gradle 9.6.1, AGP 9.3.1, Kotlin 2.3.21#1647
Daniel-ADFA wants to merge 2 commits into
task/ADFA-2602-offline-buildscript-reposfrom
task/ADFA-2602-toolchain-agp9

Conversation

@Daniel-ADFA

@Daniel-ADFA Daniel-ADFA commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Moves the on-device toolchain to Gradle 9.6.1 + AGP 9.3.1 + Kotlin 2.3.21, which collapses the duplicate Kotlin compilers the device was shipping. Gradle 9.6.1 embeds Kotlin 2.3.21 and AGP 9's built-in Kotlin resolves the same 2.3.21 compiler, so the build-script compiler and the app compiler become one artifact.

Why these exact versions

The window is constrained from both ends:

  • AGP 9.3.1 requires Gradle 9.5.0+
  • AGP 8.x fails on Gradle 9.6.0+ (uses InternalProblems, removed there)
  • Gradle's embedded Kotlin is fixed per version: 9.4.1 → 2.3.0, 9.5.1 → 2.3.20, 9.6.1 → 2.3.21, 9.7.0 → 2.4.0

This is a one-way move: at 9.6.1 there is no falling back to AGP 8 without also moving Gradle back.

Why the model migration is in the same commit

Bumping agp-tooling to match the device breaks builder-model-impl, and the migration can't land first either — overriding members that don't exist in AGP 8.13.1 won't compile. Splitting them would leave a red commit in the stack.

AGP 9 removed PrivacySandboxSdkInfo and AndroidProject.PROPERTY_ANDROID_SUPPORT_VERSION (value inlined as android.injected.studio.version), and added mappingR8TextFile, mappingR8PartitionFile, keepRulesDirectories, aarKeepRulesDirectories.

…otlin 2.3.21

Collapses the duplicate Kotlin compilers the device was shipping. Gradle
9.6.1 embeds Kotlin 2.3.21, and AGP 9's built-in Kotlin resolves the same
2.3.21 compiler, so the build-script compiler and the app compiler are one
artifact instead of two at different versions.

Version choice is constrained from both ends and is not free:

  - AGP 9.3.1 requires Gradle 9.5.0+
  - AGP 8.x fails on Gradle 9.6.0+ (it uses InternalProblems, removed there)
  - Gradle's embedded Kotlin is fixed per version: 9.4.1 -> 2.3.0,
    9.5.1 -> 2.3.20, 9.6.1 -> 2.3.21, 9.7.0 -> 2.4.0

Bumping agp-tooling to match the device forces a model migration, so it
lands here rather than separately -- splitting it would leave a commit that
does not compile. AGP 9 removed PrivacySandboxSdkInfo and
AndroidProject.PROPERTY_ANDROID_SUPPORT_VERSION (value inlined as
"android.injected.studio.version"), and added mappingR8TextFile,
mappingR8PartitionFile, keepRulesDirectories and aarKeepRulesDirectories.

app/build.gradle.kts now derives the bundled asset filenames from the
version constants instead of repeating "8.14.3" in six string literals.

Note the asset rename: builds resolve gradle-9.6.1-bin.zip, which must be
published to dev-assets before this lands or local assetsDownloadDebug
returns 404.
@Daniel-ADFA
Daniel-ADFA marked this pull request as ready for review August 11, 2026 13:59

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

// POM stays dependency-free: forcing it as a transitive would make the coordinate
// unresolvable offline whenever the harvested AGP differs from a pinned version.
compileOnly("com.android.tools.build:gradle:8.11.0")
compileOnly("com.android.tools.build:gradle:9.3.1")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-use the lib.versions.agpTooling property here - it is not recommended to define version numbers at multiple sites.

@itsaky-adfa itsaky-adfa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one minor issue to be fixed (see the previous review).

@Wadamzmail

Wadamzmail commented Aug 11, 2026

Copy link
Copy Markdown

also there's a issue when assembleRelease the apk with AGP 9.3.1 and Gradle 9.7.0
the apk output comes with missing AndroidManifest.xml and resources.arsc

MyCommit

@Wadamzmail

Wadamzmail commented Aug 11, 2026

Copy link
Copy Markdown

alao there's a issue when assembleRelease the apk with AGP 9.3.1 and Gradle 9.7.0
the apk output comes with missing AndroidManifest.xml and resources.arsc

MyCommit

After doing some tests I found that the problem had nothing to do with AGP or Gradle
it's from the project compileSdk = 37 after I downgraded it to 36 it's work perfectly
idk why it doesn't support Android 37.0 in release Build
I also updated the aapt2 from HomuHomu repo

Replace the hardcoded AGP 9.3.1 in plugin-builder's compileOnly with a
tooling-agp catalog alias so the version is defined once. plugin-builder
is also an included/standalone build, so import the root catalog in its
settings (same pattern as composite-builds/build-logic).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants